/*
 * marketsim-eclipsetrader
 *
 * Copyright (C) 2008-2011 Steve Phelps and John Cartlidge
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 */
package victria.marketsim.eclipsetrader.trading;

import java.util.LinkedList;
import java.util.List;

import victria.marketsim.core.BeanFactorySingleton;
import victria.marketsim.core.MarketService;

import net.sourceforge.eclipsetrader.core.ITradingProvider;
import net.sourceforge.eclipsetrader.core.db.Order;
import net.sourceforge.eclipsetrader.core.db.OrderRoute;
import net.sourceforge.eclipsetrader.core.db.OrderSide;
import net.sourceforge.eclipsetrader.core.db.OrderType;
import net.sourceforge.eclipsetrader.core.db.OrderValidity;

public class SimTradingProvider implements ITradingProvider {

	protected OrderController orderController;
	
	public SimTradingProvider() {
		if (orderController == null) {
			orderController = (OrderController) BeanFactorySingleton
			.getBean("orderController");			
			orderController.setProvider(this);
		}
	}
	
	public List getRoutes() {
		LinkedList result = new LinkedList();
		result.add(new OrderRoute("Victria", "Victria"));
		return result;
	}

	public List getSides() {
		LinkedList result = new LinkedList();
		result.add(OrderSide.BUY);
		result.add(OrderSide.SELL);
		return result;
	}

	public List getTypes() {
		LinkedList result = new LinkedList();
		result.add(OrderType.LIMIT);
		return result;
	}

	public List getValidity() {
		LinkedList result = new LinkedList();
		result.add(OrderValidity.GOOD_TILL_CANCEL);
		return result;
	}

	public void sendCancelRequest(Order order) {
		orderController.sendCancelRequest(order);
	}

	public void sendNew(Order order) {
		orderController.sendNew(order);
	}

	public void sendReplaceRequest(Order order) {
		// TODO Auto-generated method stub

	}

	public OrderController getOrderController() {
		return orderController;
	}

	public void setOrderController(OrderController orderController) {
		this.orderController = orderController;
	}

	
}
